]
<template>
  <div class="cgjhadd" v-if="!isEmpty(form)">
    <el-form ref="form" :model="form" :rules="rules" label-width="20%">
      <div class="contain">
        <div class="left">
          <el-collapse v-model="activeNames">
            <el-collapse-item title="租赁信息" name="1" id="shenqing">
              <div class="form-box">
                <el-form-item label="企业" prop="enterpriseName">
                  <el-input disabled v-model="form.enterpriseName"/>
                </el-form-item>
                <el-form-item label="合同总面积(㎡)" prop="contractArea">
                  <el-input v-model="form.contractArea"/>
                </el-form-item>
                <el-form-item label="开始时间" prop="beginTime">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.beginTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="结束时间" prop="endTime">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.endTime"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束时间"
                  >
                  </el-date-picker>
                </el-form-item>

                <el-form-item label="租赁保证金(元)">
                  <el-input
                    v-model="form.feSurety.surety"
                    placeholder="请输入租赁保证金"
                  />
                </el-form-item>
                <el-form-item label="装修保证金(元)">
                  <el-input
                    v-model="form.feSurety.decorationSurety"
                    placeholder="请输入装修保证金"
                  />
                </el-form-item>
                <el-form-item label="保证金缴纳时间" prop="rentFreeEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feSurety.suretyDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择保证金缴纳时间"
                  >
                  </el-date-picker>
                </el-form-item>

                <el-form-item label="租赁记录类型" prop="recordType">
                  <el-select
                    clearable
                    v-model="form.recordType"
                    placeholder="请选择租赁记录类型"
                  >
                    <el-option label="企业入驻" value="0"></el-option>
                    <el-option label="房源租赁" value="1"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="租赁记录状态" prop="recordState">
                  <el-select
                    clearable
                    v-model="form.recordState"
                    placeholder="请选择租赁记录状态"
                  >
                    <el-option label="未到期" value="0"></el-option>
                    <el-option label="已到期" value="1"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="备注" prop="remark">
                  <el-input
                    v-model="form.remark"
                    type="textarea"
                    placeholder="请输入内容"
                  />
                </el-form-item>
              </div>
            </el-collapse-item>

            <el-collapse-item title="房源列表" name="2" id="fangyuan">
              <div class="form-box1">
                <el-button
                  type="primary"
                  @click="addDevice('buiRoomList')"
                  icon="el-icon-plus"
                  size="mini"
                >选择
                </el-button
                >
                <el-table :data="buiRoomListSelect">
                  <el-table-column
                    label="房源编号"
                    align="center"
                    prop="roomNum"
                  />
                  <el-table-column label="楼层" align="center" prop="floor"/>
                  <el-table-column label="园区" align="center" prop="parkName"/>
                  <el-table-column
                    label="楼栋"
                    align="center"
                    prop="buildingName"
                  />
                  <el-table-column
                    label="房源面积(m²)"
                    align="center"
                    prop="builtUpArea"
                  />
                  <el-table-column
                    label="合同面积(m²)"
                    align="center"
                    prop="contractArea"
                  >
                    <template slot-scope="scope">
                      <el-input type="number" v-model="scope.row.contractArea" placeholder="请输入合同面积"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        @click="delDevice('buiRoomList', scope.$index)"
                      >删除
                      </el-button
                      >
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
            <el-collapse-item title="租金费用" name="3" id="dianjian1">
              <div class="form-box">
                <el-form-item label="免租开始时间" prop="rentFreeBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feOffice.rentFreeBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择免租开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="免租结束时间" prop="rentFreeEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feOffice.rentFreeEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择免租结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="租金收取开始时间" prop="rentBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feOffice.rentBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="租金收取结束时间" prop="rentEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feOffice.rentEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="下期账单时间" prop="nextRentDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feOffice.nextRentDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择下期账单时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="当前租金单价" prop="officePrice">
                  <el-input
                    v-model="form.feOffice.price"
                    placeholder="请输入当前设施费单价"/>
                </el-form-item>

                <el-form-item label="租金收取模式" prop="officeModel">
                  <el-select
                    clearable
                    v-model="form.feOffice.officeModel"
                    placeholder="请选择设施费收取模式">
                    <el-option label="以单价按月收费" value="以单价按月收费"></el-option>
                    <el-option label="以单价按季度收费" value="以单价按季度收费"></el-option>
                    <el-option label="按月固定收费" value="按月固定收费"></el-option>
                    <el-option label="按季度固定收费" value="按季度固定收费"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="计费类型" prop="calculationMode">
                  <el-select
                    clearable
                    v-model="form.feOffice.calculationMode"
                    placeholder="请选择计费类型"
                  >
                    <el-option label="手动计费" value="手动计费"></el-option>
                    <el-option label="自动计费" value="自动计费"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="生效状态" prop="effect">
                  <el-select
                    clearable
                    v-model="form.feOffice.effect"
                    placeholder="请选择生效状态"
                  >
                    <el-option label="未生效" value="0"></el-option>
                    <el-option label="已生效" value="1"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="备注" prop="remark">
                  <el-input
                    v-model="form.feOffice.remark"
                    type="textarea"
                    placeholder="请输入内容"
                  />
                </el-form-item>
              </div>

              <div class="form-box1">
                <el-table :data="form.office">
                  <el-table-column
                    label="第一年租金"
                    align="center"
                    prop="firstYearRental">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.firstYearRental"
                        placeholder="请输入第一年租金"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第二年租金"
                    align="center"
                    prop="secondYearRental">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.secondYearRental"
                        placeholder="请输入第二年租金"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第三年租金"
                    align="center"
                    prop="thirdYearRental"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.thirdYearRental"
                        placeholder="请输入第三年租金"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第四年租金"
                    align="center"
                    prop="fourthYearRental"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.fourthYearRental"
                        placeholder="请输入第四年租金"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第五年租金"
                    align="center"
                    prop="fifthYearRental"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.fifthYearRental"
                        placeholder="请输入第五年租金"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>


            <el-collapse-item title="设施使用费" name="4" id="sheshi">
              <div class="form-box">
                <el-form-item label="免租开始时间" prop="rentFreeBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feFacility.rentFreeBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择免租开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="免租结束时间" prop="rentFreeEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feFacility.rentFreeEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择免租结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="租金收取开始时间" prop="rentBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feFacility.rentBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="租金收取结束时间" prop="rentEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feFacility.rentEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="下期账单时间" prop="nextRentDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feFacility.nextRentDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择下期账单时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="当前设施费单价" prop="facilityPrice">
                  <el-input
                    v-model="form.feFacility.price"
                    placeholder="请输入当前设施费单价"/>
                </el-form-item>

                <el-form-item label="设施费收取模式" prop="officeModel">
                  <el-select
                    clearable
                    v-model="form.feFacility.facilityModel"
                    placeholder="请选择设施费收取模式">
                    <el-option label="以单价按月收费" value="以单价按月收费"></el-option>
                    <el-option label="以单价按季度收费" value="以单价按季度收费"></el-option>
                    <el-option label="按月固定收费" value="按月固定收费"></el-option>
                    <el-option label="按季度固定收费" value="按季度固定收费"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="计费类型" prop="calculationMode">
                  <el-select
                    clearable
                    v-model="form.feFacility.calculationMode"
                    placeholder="请选择计费类型"
                  >
                    <el-option label="手动计费" value="手动计费"></el-option>
                    <el-option label="自动计费" value="自动计费"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="生效状态" prop="effect">
                  <el-select
                    clearable
                    v-model="form.feFacility.effect"
                    placeholder="请选择生效状态"
                  >
                    <el-option label="未生效" value="0"></el-option>
                    <el-option label="已生效" value="1"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="备注" prop="remark">
                  <el-input
                    v-model="form.feFacility.remark"
                    type="textarea"
                    placeholder="请输入内容"
                  />
                </el-form-item>
              </div>
              <div class="form-box1">
                <el-table :data="form.facility">
                  <el-table-column
                    label="第一年配套设施使用费（实收/应收）"
                    align="center"
                    prop="firstYearFacilityFee">
                    <template slot-scope="scope">

                      <el-input
                        v-model="scope.row.firstFacilityFee"
                        placeholder="第一年配套设施使用费"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第二年配套设施使用费（实收/应收）"
                    align="center"
                    prop="secondYearFacilityFee"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.secondFacilityFee"
                        placeholder="请输入第二年费用"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第三年配套设施使用费（实收/应收）"
                    align="center"
                    prop="thirdYearFacilityFee"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.thirdFacilityFee"
                        placeholder="请输入第三年费用"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第四年配套设施使用费（实收/应收）"
                    align="center"
                    prop="fourthYearFacilityFee"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.fourthFacilityFee"
                        placeholder="请输入第四年费用"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="第五年配套设施使用费（实收/应收）"
                    align="center"
                    prop="fifthYearFacilityFee"
                  >
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row.fifthFacilityFee"
                        placeholder="请输入第五年费用"
                      />
                    </template>
                  </el-table-column>
                </el-table>


              </div>
            </el-collapse-item>


            <el-collapse-item title="物业费用" name="5" id="wuye">
              <div class="form-box">
                <el-form-item label="物业免收开始时间" prop="freeBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feProperty.freeBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="物业免收开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="物业免收结束时间" prop="freeEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feProperty.freeEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="物业免收结束时间"
                  >
                  </el-date-picker>
                </el-form-item>

                <el-form-item label="物业收取开始时间" prop="propertyBeginDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feProperty.propertyBeginDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="物业收取开始时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="物业收取结束时间" prop="propertyEndDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feProperty.propertyEndDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="物业收取结束时间"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="下期账单时间" prop="nextPropertyDate">
                  <el-date-picker
                    clearable
                    size="small"
                    v-model="form.feProperty.nextPropertyDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="选择下期账单时间"
                  >
                  </el-date-picker>
                </el-form-item>

                <el-form-item label="物业收费模式" prop="feeModel">
                  <el-select v-model="form.feProperty.feeModel">
                    <el-option value="0" label="按月"></el-option>
                    <el-option value="1" label="按季"></el-option>
                  </el-select>
                </el-form-item>

                <el-form-item label="收费金额" prop="feeStandard">
                  <el-input
                    v-model="form.feProperty.feeStandard"
                    placeholder="请输入计价标准"
                  />
                </el-form-item>
              </div>
            </el-collapse-item>
            <el-collapse-item title="附件" name="7" id="fujian" v-if="!isEmpty(form.id)">
              <div class="form-box">
                <el-form-item label="附件">
                  <FileUpload ref="fileupload" :fileListTem="form.fileIdList" :fileSize="fileSize" :limit="20"/>
                </el-form-item>
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
        <div class="right">
          <div class="my-steps-box">
            <div
              :class="['step-item', stepSelect == index ? 'step-active' : '']"
              v-for="(item, index) in step"
              :key="index"
            >
              <div class="top-title" @click="jump(item.to, index)">
                <div class="cricle"></div>
                <span class="text">{{ item.text }}</span>
              </div>
              <div class="line"></div>
            </div>
          </div>
        </div>
      </div>
    </el-form>

    <div class="big-foot-fixed">
      <el-button type="primary" @click="submitForm">提交</el-button>
      <el-button type="primary" @click="cancel">返回</el-button>
    </div>

    <el-dialog :title="title" :visible.sync="dialogdeviceVisible">
      <div v-if="typeFee === 'buiRoomList'">
        <el-form
          :model="queryListBuiRoom"
          ref="queryListBuiRoomForm"
          :inline="true"
          label-width="68px"
        >

          <el-form-item label="园区" prop="roomType" label-width="40px">
            <el-select
              style="width: 150px"
              clearable
              v-model="queryListBuiRoom.parkName"
              placeholder="请选择园区"
            >
              <el-option
                v-for="item in parkList"
                :key="item.id"
                :label="item.parkName"
                :value="item.parkName"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="楼栋" prop="state" label-width="40px">
            <el-select
              style="width: 150px"
              clearable
              v-model="queryListBuiRoom.buildingName"
              placeholder="请选择楼栋"
            >
              <el-option
                v-for="item in buildingList"
                :key="item.id"
                :label="item.buildingName"
                :value="item.buildingName"
              />
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="queryListBuiRoomFn"
            >搜索
            </el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQueryListBuiRoomFn"
            >重置
            </el-button
            >
            <el-button icon="el-icon-plus" size="mini" @click="$router.push('/smartParks/parkAssets/buildingRoom')"
            >添加房源
            </el-button
            >
          </el-form-item>
        </el-form>
        <el-table
          key="buiRoomList"
          ref="buiRoomListRef"
          :data="buiRoomList"
          class="device-style"
          v-loading="loading"
          max-height="250"
          :row-key="getRowKey"
          @selection-change="handleDevice"
        >
          <el-table-column
            v-if="typeFee === 'buiRoomList'"
            type="selection"
            :reserve-selection="true"
            width="55"
            align="center"
          />
          <el-table-column label="房源编号" align="center" prop="roomNum"/>
          <el-table-column label="楼层" align="center" prop="floor"/>
          <el-table-column label="园区" align="center" prop="parkName"/>
          <el-table-column label="楼栋" align="center" prop="buildingName"/>
          <el-table-column
            label="房源面积(m²)"
            align="center"
            prop="builtUpArea"
          />
        </el-table>
        <pagination v-show="buiRoomListTotal > 0" :total="buiRoomListTotal"/>
      </div>

      <span slot="footer" class="dialog-footer">
            <el-button @click="cancelDevice(typeFee)">取 消</el-button>
            <el-button type="primary" @click="submitDevice(typeFee)"
            >确 定</el-button
            >
          </span>
    </el-dialog>


  </div>
</template>
<script>
import {
  getQyEnterprise,
  addQyEnterprise,
  updateQyEnterprise
} from '@/api/smartParks/merchants/merchantsCompanySettlein'
import {
  listFeLeaseRecord,
  getFeLeaseRecord,
  delFeLeaseRecord,
  addFeLeaseRecord,
  updateFeLeaseRecord
} from '@/api/smartParks/operatingFee/leasing'
import { listZsCustomer } from '@/api/smartParks/merchants/merchantsCustomer'
import FileUpload from '@/views/smartParks/parkAssets/components/FileUpload.vue'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { listBuiPark } from '@/api/parkAssets/enterCommunity'
import { listBuiBuilding } from '@/api/parkAssets/building'
import { listBuiRoom } from '@/api/parkAssets/buildingRoom'
export default {
  name: 'LeasingDetail',
  components: {
    FileUpload
  },
  data() {
    return {
      activeNames: ['1', '2', '3', '4', '5', '6','7'],
      fileSize: 20,//上传文件大小限制
      step: [
        {
          to: 'shenqing',
          text: '租赁信息'
        },
        {
          to: 'fangyuan',
          text: '房源信息'
        },
        {
          to: 'dianjian1',
          text: '租金费用'
        },
        {
          to: 'sheshi',
          text: '设施费用'
        },
        {
          to: 'wuye',
          text: '物业费用'
        },
        {
          to: 'otherfee',
          text: '其他费用'
        },
        {
          to: 'fujian',
          text: '附件'
        }
      ],
      stepSelect: 0,
      // 表单参数
      form: {
        id: null,
        enterpriseName: null,
        legalPerson: null,
        legalPhone: null,
        enterpriseContact: null,
        contactPhone: null,
        enterpriseType: null,
        registrationDate: null,
        mainProduct: null,
        enterpriseScale: null,
        taxRegistrationDate: null,
        approvalDate: null,
        acceptanceDate: null,
        createBy: null,
        productionStatus: null,
        createTime: null,
        address: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null,
        tenantId: null,
        fileIdList: [],
        roomIdList: [], //
        roomVOList: [],

        feSurety: {
          id: null,
          surety: null,
          decorationSurety: null,
          suretyDate: null
        },
        feOffice: {
          id: null,
          rentFreeBeginDate: '',
          rentFreeEndDate: '',
          rentBeginDate: '',
          rentEndDate: '',
          nextRentDate: '',
          effect: '',
          calculationMode: '',
          firstYearRental: '',
          secondYearRental: '',
          thirdYearRental: '',
          fourthYearRental: '',
          fifthYearRental: '',
          facilityModel:'',
          price:'',
        },
        feFacility: {
          id: null,
          rentFreeBeginDate: '',
          rentFreeEndDate: '',
          rentBeginDate: '',
          rentEndDate: '',
          nextRentDate: '',
          effect: '',
          calculationMode: '',
          firstFacilityFee: '',
          secondFacilityFee: '',
          thirdFacilityFee: '',
          fourthFacilityFee: '',
          fifthFacilityFee: '',
          officeModel:'',
          price:'',
        },
        feProperty: {
          id: null,
          propertyBeginDate: null,
          propertyEndDate: null,
          freeBeginDate: null,
          freeEndDate: null,
          nextPropertyDate: null,
          feeModel: '',
          feeStandard: ''
        },
        office: [],
        facility: []
      },
      dialogdeviceVisible: false, //房源
      buiRoomList: [], //房源列表
      buildingList: [],//所有房源
      title:'',
      queryListBuiRoom: {
        parkName: '',
        buildingName: ''
      },
      typeFee:'',
      parkList: [],

      buiRoomListSelect:[],
      zsCustomerList: [], //或缺企业
      buiRoomListTotal: '',
      // 表单校验
      rules: {
        enterpriseName: [
          { required: true, message: '企业名称不能为空', trigger: 'blur' }
        ],
        legalPerson: [
          { required: true, message: '企业法人不能为空', trigger: 'blur' }
        ],
        legalPhone: [
          { required: true, message: '法人联系电话不能为空', trigger: 'blur' }
        ]
      },

      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      loading: false
    }
  },
  beforeRouteLeave(to, from, next) {
    this.$store.dispatch('tagsView/delView', this.$route)
    next()
  },
  created() {
    getFeLeaseRecord(this.$route.query.id).then((response) => {
      // this.step= [
      //   {
      //     to: "shenqing",
      //     text: "申请信息",
      //   },
      //   {
      //     to: "dianjian1",
      //     text: "费用选择",
      //   }
      // ]
      this.form = response.data
      this.form.facility = [this.form.feFacility]
      this.form.office = [this.form.feOffice]
      this.buiRoomListSelect = this.form.roomVOList
      //this.form.feProperty = [this.form.feProperty];
      this.form.feFacility.effect = this.form.feFacility.effect + ''
      this.form.feOffice.effect = this.form.feOffice.effect + ''
      // this.step.push({
      //     to: "fujian",
      //     text: "附件上传",
      //   })
      console.log(this.form)
    })
    // this.getmaintainList(); //列表
    this.getParkBuiBuildingList()
  },
  methods: {
    delDevice(param, index) {
      if (param === 'buiRoomList') {
        this.buiRoomListSelect.splice(index, 1)
      }
      if (param === 'office') {
        this.OfficeTotalSel = []
      }
      if (param === 'facilities') {
        this.feFacilitySel = []
      }

      if (param === 'property') {
        this.fePropertyListSel = []
      }
      if (param === 'fixed') {
        this.feFixedListSel = []
      }
      if (param === 'park') {
        this.feParkingListSel = []
      }
    },
    handleDevice(val) {
      if (this.typeFee === 'buiRoomList') {
        this.buiRoomListSelectTem = val
      }
      if (this.typeFee === 'office') {
        this.OfficeTotalTem = val
      }
      if (this.typeFee === 'facilities') {
        this.feFacilityTem = val
      }
      if (this.typeFee === 'elevator') {
        this.feElevatorListTem = val
      }
      if (this.typeFee === 'property') {
        this.fePropertyListTem = val
      }
      if (this.typeFee === 'fixed') {
        this.feFixedListTem = val
      }
      if (this.typeFee === 'park') {
        this.feParkingListTem = val
      }
      if (this.typeFee === 'chooseEnter') {
        this.chooseEnterTem = val
      }
    },
    submitDevice() {
      this.dialogdeviceVisible = false
      if (this.typeFee === 'buiRoomList') {

        let selectList = JSON.parse(JSON.stringify(this.buiRoomListSelectTem));
        for (const item of selectList){
          item.contractArea = item.builtUpArea
          this.buiRoomListSelect.push( item)
        }
      }
      console.log(this.buiRoomListSelect)
    },
    getRowKey(row) {
      return row.id
    },

    queryListBuiRoomFn() {
      let data = {
        leaseState: 0,
        // roomTypeList: ["0", "2"],
        stateList: ['租赁'],
        ...this.queryListBuiRoom
      }
      listBuiRoom(data).then((response) => {
        this.buiRoomList = response.rows
        this.buiRoomListTotal = response.total
        this.loading = false
      })
    },
    cancelDevice() {
      this.dialogdeviceVisible = false
    },
    getParkBuiBuildingList() {
      //查询园区列表，赋值给parkList;
      listBuiPark().then((response) => {
        this.parkList = response.rows
      })

      listBuiBuilding().then((response) => {
        this.buildingList = response.rows
      })
      this.queryListBuiRoomFn();
    },
    resetQueryListBuiRoomFn() {
      this.queryListBuiRoom = {
        parkNum: '',
        buildingNum: ''
      }
      this.queryListBuiRoomFn()
    },
    //是否生效，生效后不能修改
    // isEffect(){
    //   return (this.form.effect === 1 || this.form.effect === '1');
    // },
    jump(domId, index) {
      this.stepSelect = index
      //页面滚动了的距离
      let height =
        window.pageYOffset ||
        document.documentElement.scrollTop ||
        document.body.scrollTop
      let dom = document.getElementById(domId)
      // let domHeight = dom.offsetTop + 60;
      let domHeight = dom.offsetTop - 104
      //滚动距离计算
      var S = Number(height) - Number(domHeight)
      //判断上滚还是下滚
      if (S < 0) {
        //下滚
        S = Math.abs(S)
        window.scrollBy({
          top: S,
          behavior: 'smooth'
        })
      } else if (S == 0) {
        //不滚
        window.scrollBy({
          top: 0,
          behavior: 'smooth'
        })
      } else {
        //上滚
        S = -S
        window.scrollBy({
          top: S,
          behavior: 'smooth'
        })
      }
    },
    changeEnter() {
      if (this.form.customerId) {
        let itemTep = this.zsCustomerList.filter((item) => {
          return item.id == this.form.customerId
        })
        this.form.enterpriseName = itemTep[0].enterpriseName
          ? itemTep[0].enterpriseName
          : undefined
        this.form.enterpriseContact = itemTep[0].enterpriseContact
          ? itemTep[0].enterpriseContact
          : undefined
        this.form.contactPhone = itemTep[0].contactPhone
          ? itemTep[0].contactPhone
          : undefined
        this.form.enterpriseType = itemTep[0].enterpriseType
          ? itemTep[0].enterpriseType
          : undefined
      } else {
        this.form.enterpriseName = undefined
        this.form.enterpriseContact = undefined
        this.form.contactPhone = undefined
        this.form.enterpriseType = undefined
      }
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        enterpriseName: null,
        legalPerson: null,
        legalPhone: null,
        enterpriseContact: null,
        contactPhone: null,
        enterpriseType: null,
        registrationDate: null,
        mainProduct: null,
        enterpriseScale: null,
        taxRegistrationDate: null,
        approvalDate: null,
        acceptanceDate: null,
        createBy: null,
        productionStatus: null,
        createTime: null,
        address: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        delFlag: null,
        tenantId: null,
        fileIdList: [],
        leaseRecord: {
          roomIdList: [], //
          elevatorFeeId: '', //电梯
          facilityFeeId: '', //设施
          fixedFeeId: '', //固定费用
          officeFeeId: '', //办公费用
          propertyFeeId: '', //物业
          parkingFeeId: '' //停车费用
        }
      }

      this.resetForm('form')
    },
    // 取消按钮
    cancel() {
      this.$store.dispatch('tagsView/delView', this.$route)
      this.$router.go(-1)
    },

    //获取列表
    getmaintainList() {
      //选择企业
      listZsCustomer().then((response) => {
        this.zsCustomerList = response.rows
      })

    },

    submitForm: function() {
      this.$refs['form'].validate((valid) => {
        if (valid) {
          let data = JSON.parse(JSON.stringify(this.form))
          data.fileIdList = this.$refs.fileupload.fileList.map(
            (item) => item.id
          );
          data.feFacility.firstFacilityFee = this.form.facility[0].firstFacilityFee
          data.feFacility.secondFacilityFee = this.form.facility[0].secondFacilityFee
          data.feFacility.thirdFacilityFee = this.form.facility[0].thirdFacilityFee
          data.feFacility.fourthFacilityFee = this.form.facility[0].fourthFacilityFee
          data.feFacility.fifthFacilityFee = this.form.facility[0].fifthFacilityFee

          data.feOffice.firstYearRental = this.form.office[0].firstYearRental
          data.feOffice.secondYearRental = this.form.office[0].secondYearRental
          data.feOffice.thirdYearRental = this.form.office[0].thirdYearRental
          data.feOffice.fourthYearRental = this.form.office[0].fourthYearRental
          data.feOffice.fifthYearRental = this.form.office[0].fifthYearRental
          data.roomVOList = this.buiRoomListSelect;

          if (this.form.id != undefined) {
            updateFeLeaseRecord(data).then((response) => {
              if (response.code === 200) {
                this.msgSuccess('修改成功')
                setTimeout(() => {
                  this.$store.dispatch('tagsView/delView', this.$route)
                  this.$router.go(-1)
                }, 3000)
              }
            })
          } else {
            addFeLeaseRecord(data).then((response) => {
              if (response.code === 200) {
                this.msgSuccess('新增成功')
                this.reset()
              }
            })
          }
        }
      })
    },
    addDevice(param) {
      console.log(this.buildingList)

      this.dialogdeviceVisible = true
      this.typeFee = param
      if (this.typeFee === 'buiRoomList') {
        this.title = '选择房源'
        if (this.buiRoomListSelect.length > 0) {
          this.$refs.buiRoomListRef.clearSelection()
          this.$nextTick(() => {
            this.buiRoomListSelect.forEach((row) => {
              this.$refs.buiRoomListRef.toggleRowSelection(
                this.buiRoomList.find((item) => {
                  return row.id === item.id
                }),
                true
              )
            })
          })
        } else {
          this.$nextTick(() => {
            this.$refs.buiRoomListRef.clearSelection()
          })
        }
      }

    },
  }
}
</script>
<style lang="scss" scoped>
::v-deep .el-select,
.el-date-editor {
  width: 100%;
}

.big-foot-fixed {
  text-align: center;
  padding-bottom: 20px;
}

.cgjhadd {
  overflow: hidden;
  background: #f7f8f8;
  min-height: calc(100vh - 84px);
  height: auto;

  .top {
    height: 40px;
    box-sizing: border-box;
    background: #409eff !important;
    color: #fff;
    padding-left: 20px;
    display: flex;
    align-items: center;
    font-size: 12px;
    justify-content: space-between;

    .submit {
      padding: 3px 10px;
      border-radius: 10px;
      background: #fff;
      color: #409eff;
      cursor: pointer;
      margin-right: 100px;
    }
  }
}

.contain {
  height: auto !important;
  margin: 20px 20px 0px 20px;
  padding-bottom: 20px;
  display: flex;

  .left {
    .text-height {
      height: 80px;

      ::v-deep .el-form-item__content {
        height: 80px;
      }
    }

    .lrAbout {
      display: flex;
      justify-content: space-between;
    }

    width: 90%;

    ::v-deep .el-collapse {
      border-bottom: 0px;
    }

    ::v-deep .el-collapse-item {
      background: #fff;
      font-size: 12px;
      margin-bottom: 20px;

      .el-collapse-item__header,
      .el-collapse-item__wrap {
        background: "";
      }

      .el-collapse-item__header {
        position: relative;
        height: 44px;
        padding-left: 20px;
      }

      .el-collapse-item__header:before {
        position: absolute;
        content: "";
        width: 2px;
        height: 18px;
        background-color: #409eff;
        left: 0;
        top: 13px;
      }

      .el-collapse-item__wrap {
        border-top: 1px solid #e6ebf5;
      }

      .el-collapse-item__content {
        padding-top: 25px;
      }

      .form-box1 {
        width: 100%;
        padding: 0 20px;

        .el-button {
          margin-top: 10px;
        }

        .el-button:first-child {
          margin-top: -10px;
        }

        .el-table {
          margin-top: 10px;
        }
      }

      .form-box {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        padding: 0 20px;

        .el-form-item {
          width: 48%;
        }

        .el-form-item__label {
          font-size: 12px;
          font-weight: normal;
        }

        .el-form-item:nth-child(2n) {
          margin-left: 4%;
        }
      }
    }

    ::v-deep .avatar-uploader .el-upload {
      border: 1px dashed #d9d9d9;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
    }

    ::v-deep .avatar-uploader .el-upload:hover {
      border-color: #409eff;
    }

    ::v-deep .avatar-uploader-icon {
      font-size: 28px;
      color: #8c939d;
      width: 178px;
      height: 178px;
      line-height: 178px;
      text-align: center;
    }

    ::v-deep .avatar {
      width: 178px;
      height: 178px;
      display: block;
    }
  }

  .right {
    width: 10%;

    .my-steps-box {
      font-size: 12px;
      position: fixed;
      right: 30px;
      // top: 104px;
      .step-item {
        margin-bottom: 30px;
        position: relative;

        .top-title {
          display: flex;
          cursor: pointer;

          .cricle {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            margin-right: 5px;
            background: #e8eaec;
            box-sizing: border-box;
            // background: red;
            border: 2px solid #f7f8f8;
          }
        }

        .line {
          position: absolute;
          width: 2px;
          height: 30px;
          top: 12px;
          left: 5px;
          background: #e8eaec;
        }
      }

      .step-item.step-active {
        .cricle {
          border: 2px solid #d5e7f9;
          background-color: #2d8cf0;
        }

        .text {
          color: #2d8cf0;
        }
      }

      .step-item:nth-last-child(1) .line {
        display: none;
      }
    }
  }
}
</style>
